package Test;

public class BookTest {
    public static void main(String[] args) {
        //方法一：无参构造创建对象，setter方法赋值
//        Book book1 = new Book();
//        book1.setId("b001");
//        book1.setName("java");
//        book1.setPrice(30);
//        Book book2 = new Book();
//        book2.setId("b002");
//        book2.setName("c++");
//        book2.setPrice(40);
//        Book book3 = new Book();
//        book3.setId("b003");
//        book3.setName("php");
//        book3.setPrice(20);
        //方法二：有参构造创建对象的同时进行赋值
        Book book1 = new Book("b001","java",30);
        Book book2 = new Book("b002","c++",40);
        Book book3 = new Book("b003","php",20);

        book1.printBookInfo();
        book2.printBookInfo();
        book3.printBookInfo();
    }


}
